Backwards Analysis
نویسنده
چکیده
Consider the following scheme to solve the sorting problem: given n numbers to be sorted, after the ith of n (1 ≤ i ≤ n), we will make sure that we have i of input numbers in a sorted list. Clearly these i sorted numbers will partition the ranks of the remaining n− i unsorted numbers into i + 1 intervals. The (i + 1)th step consists of choosing one of the n − i unsorted numbers uniformly at random, and inserting it into the sorted list. After n such insertion steps, we are left with a list of all the input numbers, in sorted order. This algorithm can be viewed as a variant of quicksort algorithm [2]. To perform the insertion step, throughout the algorithm we maintain a pointer for each number yet to be inserted into the sorted list.After the ith step, the pointer for each uninserted number specifies which of the i + 1 intervals in the sorted list it would be inserted into, if it were the next to be inserted. The pointers are bidirectional, so that given an interval we can determine the numbers whose pointers point to it. Suppose we insert a number x whose pointers point to interval I, thus the work required to update the pointers is proportional to the number of pointers point to I. Consider the work done in the ith step when the objects in the input are considered in a random order. While we could directly analyze this random variable, we introduce a useful tool: backwards analysis. By using backwards analysis, we imagine that the algorithm is running backwards starting from the sorted list we have at the end. Thus, in analyzing the ith step, we imagine that we are deleting one of the i numbers in the sorted list and updating the pointers .The work needs to be done in updating the pointers in this case is the same as if we had run the algorithm forward. There is a second crucial component to backwards analysis: since the numbers were added in random order in the original algorithm, in the backwards analysis we may assume that each of the i numbers in the sorted list is equally likely to be deleted at this step. Since there are i intervals and n − i + 1 pointers remaining after the deletion, The expected number of pointers to be updated at this step is O(n−i i ), which is O(ni ). By linearity of expectation, we sum the work done over all the steps and obtain a bound of O ∑ i( n i ) = O(n log n) on the expectation of the total work.
منابع مشابه
A New Acceptance Sampling Design Using Bayesian Modeling and Backwards Induction
In acceptance sampling plans, the decisions on either accepting or rejecting a specific batch is still a challenging problem. In order to provide a desired level of protection for customers as well as manufacturers, in this paper, a new acceptance sampling design is proposed to accept or reject a batch based on Bayesian modeling to update the distribution function of the percentage of nonconfor...
متن کاملThe Entropy of Backwards Analysis
Backwards analysis, first popularized by Seidel, is often the simplest most elegant way of analyzing a randomized algorithm. It applies to incremental algorithms where elements are added incrementally, following some random permutation, e.g., incremental Delauney triangulation of a pointset, where points are added one by one, and where we always maintain the Delauney triangulation of the points...
متن کاملBackwards Design or looking Sideways? Knowledge Translation in the Real World; Comment on “A Call for a Backward Design to Knowledge Translation”
El-Jardali and Fadllallah provide an excellent summary of the many dimensions of knowledge use, and the breath of issues and activities that must be considered if knowledge is to be put into practice. However, reliance on a continuum (rather than a cyclical, multidirectional, systems) model creates a number of limitations, particularly when promoting evidence-informed action in the areas of hea...
متن کاملAnalysing Logic Programs by Reasoning Backwards
One recent advance in program development has been the application of abstract interpretation to verify the partial correctness of a (constraint) logic program. Traditionally forwards analysis has been applied that starts with an initial goal and traces the execution in the direction of the control-flow to approximate the program state at each program point. This is often enough to verify asser...
متن کاملGoal-Directed Backwards Static Analysis for JavaScript
JavaScript is notoriously difficult to analyze due to its rampant use of standard dynamic features (e.g. duck typing, dynamic dispatch, first-class functions, and run-time string evaluation), as well as its idiosyncratic approach to scoping (scope object chains) and inheritance (prototyping). Therefore, despite its near-universal adoption as a client-side scripting language and its increasing u...
متن کامل